import request from '@/utils/request'
// 获取员工列表
export const sysUser = params => {
  return request({
    url: '/sys/user',
    params
  })
}
/*
restful:
  增：post  删:delete  改:put(全量)/patch(部分)  查:get
  请求的url都一样
  增传参：data
  删传参：url拼接id,params
  改传参：url拼接id,data
  查:params
*/
// 新增员工
export const sysUserPost = data => {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}
// 删除员工
export const sysUserDelete = id => {
  return request({
    url: '/sys/user/' + id,
    method: 'delete'
  })
}
// 批量导入
export const sysUserBatch = data => {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}
// 获取员工基础信息
export function employeesPersonalInfo (id) {
  return request({
    url: `/employees/${id}/personalInfo`
  })
}
// 修改员工基础信息
export function employeesPersonalInfoPut (data) {
  return request({
    url: `/employees/${data.userId}/personalInfo`,
    method: 'put',
    data
  })
}
// 获取岗位信息
export const employeesJobs = id => {
  return request({
    url: `/employees/${id}/jobs`
  })
}
// 修改岗位信息
export const employeesJobsPut = data => {
  return request({
    url: `/employees/${data.userId}/jobs`,
    method: 'put',
    data
  })
}
// 给员工分配角色
export const sysUserAssignRoles = data => {
  return request({
    url: '/sys/user/assignRoles',
    method: 'put',
    data
  })
}
